#ifndef STATICCHECKER_H
#define STATICCHECKER_H
#include <QVector>

/*
根据阈值表的静态异常检查类
由数据主机数据采集模块提供dvData数据
输出是否异常 1为 异常， 0 为正常
*/
class StaticChecker
{
public:
    StaticChecker();

    bool CmprS_cpu_userSys(double cpu_user, double cpu_sys, double cpu_total);
    bool CmprS_cpu_iowait(double cpu_iowait, double cpu_total);
    bool CmprS_cpu_idleRun(double cpu_idle, double cpu_total, double cpu_running);
    bool CmprS_cpu_intrUsed(double cpu_intr, double cpu_total, double cpu_used);
    bool CmprS_cpu_contxtSys(double cpu_contxt, double cpu_total, double cpu_sys);
    bool CmprS_mem_swapinOut(double in, double out);
    bool CmprS_mem_leak(double mem_used, double mem_active, double mem_total);

    void GetValue(QVector<double> dvData);
    bool CmprQuota();
private:
    double S_cpu_userSys_up;
    double S_cpu_userSys_down;
    double S_cpu_iowait_up;
    double S_cpu_iowait_down;
    double S_cpu_idleRun_iup;
    double S_cpu_idleRun_idown;
    double S_cpu_idleRun_rup;
    double S_cpu_idleRun_rdown;
    double S_cpu_intrUsed_iup;
    double S_cpu_intrUsed_idown;
    double S_cpu_intrUsed_uup;
    double S_cpu_intrUsed_udown;
    double S_cpu_contxtSys_cup;
    double S_cpu_contxtSys_cdown;
    double S_cpu_contxtSys_sup;
    double S_cpu_contxtSys_sdown;
    double S_mem_swapinOut_in;
    double S_mem_swapinOut_out;
    double S_mem_leak_uup;
    double S_mem_leak_udown;
    double S_mem_leak_aup;
    double S_mem_leak_adown;

    bool b_cpu_userSys_limit;
    bool b_cpu_iowait_limit;
    bool b_cpu_idleRun_limit;
    bool b_cpu_intrUsed_limit;
    bool b_cpu_contxtSys_limit;
    bool b_mem_swapinOut_limit;
    bool b_mem_leak_limit;
};

#endif // STATICCHECKER_H
